<template>
  <div>
    <div class="settlement">
      <div class="chack">
        <input
          type="checkbox"
          name=""
          id="selectAll"
          class="select"
          :checked="getState"
          @change="btnchanfe"
        />
        <label for="selectAll"> 全选</label>
      </div>
      <div class="sunPrice">
        合计：<span>￥{{ sunPrice1.toFixed(2) }}</span>
      </div>
      <div class="close">
        <span> 结算({{ sunNum1 }}) </span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    state: {
      type: Boolean,
    },
    // 商品总价
    sunPrice1: {
      type: Number,
      default: 0,
    },
    // 商品 数量
    sunNum1: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      // 商品数量
      countSun: this.sunNum1,
      // 商品总价
      priceSun: this.sunPrice1,

    };
  },
  computed: {
    // 获取当前的全选状态
    getState() {
      return (this.fullState = this.state);
    },
  },
  methods: {
    btnchanfe(e) {
      this.$emit("btnchange", e.target.checked);
    },
  },
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}
.settlement {
  position: fixed;
  display: flex;
  line-height: 50px;
  padding: 0 10px;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: white;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  .chack {
    flex: 30%;
  }
  .sunPrice {
    flex: 40%;
    span {
      color: red;
      font-weight: 600;
    }
  }
  .close {
    flex: 30%;
    // background-color: aqua;
    // padding: 10px;
    span {
      display: block;
      background-color: #0077ff;
      color: white;
      text-align: center;
      width: 85%;
      height: 40px;
      line-height: 40px;
      margin-top: 5px;
      border-radius: 30px;
      cursor: pointer;
      font-size: 14px;
    }
  }
}
</style>